export function createNodes(component) {
    var node = {}    
      node.component = component.id
      node.componentModel = component
      var configDict = {}
      configDict.componentStyle = {
        background: '#FFFFFF',
        width: 750
      }
      configDict.itemStyle = {
        width: 750,
        background: '#FFFFFF',
        widthForCover1: 365,
        heightForCover1: 220
      }
      node.configDict = configDict
      node.isShow = true

      var n = 0
      switch (component.name) {
        case 'banner':
          n=2
          node.background = '#FFFFFF'
          node.widthForCover1 = 750
          node.heightForCover1 = 300
          node.duration = 2000
          break;
        case 'grid':
          n=2
          
          break;
        case 'noticebar':
          n=2
          node.direction = 'row'
          node.speed = 80
          node.duration = 2000
          node.number = 1
          node.width = 750
          node.height = 40
          break;
        case 'itemGrid':
          n=2
          node.widthForFlex1 = 345
          node.flex_directionForFlex1 = 'column'
          node.align_itemsForFlex1 = 'flex-start'
          node.backgroundForFlex1 = '#FFFFFF'
          node.widthForCover1 = 345
          node.heightForCover1 = 200
          node.marginLeftForFlex1 = 20
          node.marginTopForFlex1 = 20
          node.isShowForText1 = true
          node.isShowForText2 = true
          node.isShowForText3 = true
          node.isShowForText4 = true
          node.filter = ''
          break;
        case 'itemList':
          n=2
          node.widthForFlex1 = 345
          node.flex_directionForFlex1 = 'column'
          node.align_itemsForFlex1 = 'flex-start'
          node.backgroundForFlex1 = '#FFFFFF'
          node.widthForCover1 = 345
          node.heightForCover1 = 200
          node.marginLeftForFlex1 = 20
          node.marginTopForFlex1 = 20
          node.isShowForText1 = true
          node.isShowForText2 = true
          node.isShowForText3 = true
          node.isShowForText4 = true
          node.filter = ''
          break;
        case 'share':
          n=1
          node.widthForFlex1 = 750
          node.heightForFlex1 = 1300
          node.widthForCover1 = 200
          node.heightForCover1 = 200
          break;
        case 'item-baseinfo':
          n=1
          node.width = 750
          node.widthForCover1 = 750
          node.heightForCover1 = 800
          break;
        case 'item-detail':
          n=1
          node.width = 750
          node.widthForCover1 = 750
          break;
        case 'itemCate':
          n=1
          node.width = 750
          node.height = 1300
          break;
        case 'custom':
          n=1
          node.width = 750
          node.height = 200
          node.background = '#FFFFFF'
          break;
        default:
          break;
      }
      var itemList = []
      var itemModel = {}
      var number = 1
      while (1) {
        if(number > n){
          break
        }else{
          if(component.name=='itemGrid'){
            advertList.push({
              sort: number,
              coverUrl: '',
              content: '',
              title: '',
              itemModel: {
                itemName: '',
                coverUrl: '',
                price: '',
                marketPrice: '',
                sales: '',
              }
            })
          }else if(component.name=='itemList'){
            itemList.push({
              itemName: '',
              coverUrl: '',
              price: '',
              marketPrice: '',
              sales: '',
            })
          }else if(component.name=='limitedTimeKill'){
            itemList.push({
              itemName: '',
              coverUrl: '',
              price: '',
              marketPrice: '',
              sales: '',
            })
          }else if(component.name=='item-baseinfo'){
            itemModel = {
              'itemName': '商品名称',
              'price': '99',
              'marketPrice': '200',
              'publicity': '商品宣传语',
            }
          }else if(component.name=='item-detail'){
            itemModel = {
              'intro': '商品描述',
              'detailPhotoList': [{'coverUrl': ''}]
            }
          }else{
            itemList.push({
              sort: number,
              coverUrl: '',
              content: '',
              title: '',
            })
          }
        }
        number ++
      }
    node.configDict.itemList = itemList
    node.itemModel = itemModel
    return node
  }